package com.cq.hd.order.api.excel;

import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.cq.hd.common.utils.LocalDateUtil;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;

@Getter
public class CommissionOrderSheet implements Serializable {

    @Setter
    @ExcelProperty(value = "订单号", index = 0)
    @ColumnWidth(24)
    @ApiModelProperty(value = "订单号")
    private String orderNo;

    @Setter
    @ExcelProperty(value = "活动id", index = 1)
    @ColumnWidth(20)
    @ApiModelProperty(value = "活动id")
    private Long activeId;

    @Setter
    @ExcelProperty(value = "活动名称", index = 2)
    @ColumnWidth(20)
    @ApiModelProperty(value = "活动名称")
    private String activeTitle;

    @Setter
    @ExcelProperty(value = "商家简称", index = 3)
    @ColumnWidth(20)
    @ApiModelProperty(value = "商家简称")
    private String businessShortName;

    @Setter
    @ExcelProperty(value = "经纪人名称", index = 4)
    @ColumnWidth(20)
    @ApiModelProperty(value = "经纪人名称")
    private String agentNickName;

    @Setter
    @ExcelProperty(value = "经纪人手机号", index = 5)
    @ColumnWidth(20)
    @ApiModelProperty(value = "经纪人手机号")
    private String agentMobile;

    @Getter
    @ExcelProperty(value = "订单总价", index = 6)
    @ColumnWidth(20)
    @ApiModelProperty(value = "订单总价")
    private String orderPrice;

    @Getter
    @ExcelProperty(value = "实付金额", index = 7)
    @ColumnWidth(20)
    @ApiModelProperty(value = "实付金额")
    private String payPrice;

    @Getter
    @ExcelProperty(value = "预估佣金", index = 8)
    @ColumnWidth(20)
    @ApiModelProperty(value = "预估佣金")
    private String actualCommissionAmt;

    @Getter
    @ExcelProperty(value = "结算佣金", index = 9)
    @ColumnWidth(20)
    @ApiModelProperty(value = "结算佣金")
    private String settledCommissionAmt;

    @Getter
    @ExcelProperty(value = "下单时间", index = 10)
    @ColumnWidth(24)
    @ApiModelProperty(value = "下单时间")
    private String orderTime;

    public void setOrderPrice(BigDecimal getOrderPrice) {
        if (getOrderPrice != null) {
            this.orderPrice = getOrderPrice.setScale(2, BigDecimal.ROUND_HALF_UP).toString();
        }
    }

    public void setPayPrice(BigDecimal getPayPrice) {
        if (getPayPrice != null) {
            this.payPrice = getPayPrice.setScale(2, BigDecimal.ROUND_HALF_UP).toString();
        }
    }

    public void setActualCommissionAmt(BigDecimal getActualCommissionAmt) {
        if (getActualCommissionAmt != null) {
            this.actualCommissionAmt = getActualCommissionAmt.setScale(2, BigDecimal.ROUND_HALF_UP).toString();
        }
    }

    public void setSettledCommissionAmt(BigDecimal getSettledCommissionAmt) {
        if (getSettledCommissionAmt != null) {
            this.settledCommissionAmt = getSettledCommissionAmt.setScale(2, BigDecimal.ROUND_HALF_UP).toString();
        }
    }

    public void setOrderTime(LocalDateTime getOrderTime) {
        if (getOrderTime != null) {
            this.orderTime = LocalDateUtil.toLocalDateTimeToString(getOrderTime, "yyyy.MM.dd HH:mm:ss");
        }
    }
}
